﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using INSTA.MusiqueStore.DAL;

namespace INSTA.MusiqueStore.UI.Windows
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var a = CustomMusiqueStoreEntities.GetAlbum(int.Parse(numericUpDown1.Text));

                lblTitre.Text = a.Nom;
                lblDuree.Text = a.Durée.ToString();
                lblSortie.Text = a.DateSortie.ToShortDateString();

                picCover.ImageLocation = Properties.Settings.Default.COVERPATH + a.LienPochette;
                Console.WriteLine(picCover.ImageLocation);
                picCover.SizeMode = PictureBoxSizeMode.StretchImage;

                dataGridView1.DataSource = a.Piste.ToList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
        
    }
}
